test(mbt): Add Model Based Test for Emerald#201
Conversation
029e72f to
d09bd51
Compare
| #[quint_run( | ||
| spec = "../../specs/emerald_mbt.qnt", | ||
| step = "step_no_failures", | ||
| max_samples = 32, | ||
| max_steps = 128 | ||
| )] | ||
| fn simulation_no_failures() -> impl Driver { | ||
| EmeraldDriver::default() | ||
| } | ||
|
|
||
| #[quint_run( | ||
| spec = "../../specs/emerald_mbt.qnt", | ||
| step = "step_with_failures", | ||
| max_samples = 32, | ||
| max_steps = 128 | ||
| )] | ||
| fn simulation_with_failures() -> impl Driver { | ||
| EmeraldDriver::default() | ||
| } |
There was a problem hiding this comment.
First uncached run took about 30m in the CI. Let me know if you want to generate fewer traces or reduce the number of steps to minimize test time.
bugarela
left a comment
There was a problem hiding this comment.
All good from my side!
9b46ba5 to
6343e8e
Compare
58ca2f7 to
1de9af2
Compare
6343e8e to
b9b7e32
Compare
1de9af2 to
54fca10
Compare
b9b7e32 to
133095a
Compare
9f61e97 to
3d62414
Compare
This patch connects the newly added Quint specs to Emerald's code via the Quint Connect library.
3d62414 to
805fcc9
Compare
| let res = Command::new("make") | ||
| .env("RETH_NODES", nodes) | ||
| .arg(cmd) | ||
| .current_dir("../..") |
There was a problem hiding this comment.
can we use absolute path here?
you may use CARGO_MANIFEST_DIR.
| if !res.status.success() { | ||
| bail!( | ||
| "Failed to run make command: {}", | ||
| String::from_utf8_lossy(&res.stderr) | ||
| ); | ||
| } |
| impl Runtime { | ||
| pub fn new(temp_dir: TempDir) -> Result<Self> { | ||
| Ok(Self { | ||
| tokio: tokio::runtime::Runtime::new()?, |
| - name: Run Forge build | ||
| run: forge build | ||
| if: steps.filter.outputs.code == 'true' |
There was a problem hiding this comment.
make mbt-test is already calling forge build.
| /// creating one Emerald and Reth instance per [crate::NODES]. | ||
| pub fn init(&mut self) -> Result<()> { | ||
| // Reset the driver | ||
| *self = Default::default(); |
There was a problem hiding this comment.
can you explain this line ?
I would rather prefer pub fn reinit(self) -> Result<Self> { ... }
| /// - [FailureMode::ProcessRestart]: Restarts Emerald only | ||
| pub fn failure(&mut self, node: Node, mode: FailureMode) -> Result<()> { | ||
| if let FailureMode::ConsensusTimeout = mode { | ||
| // Noop wrt. MBT. The model will follow up with the propoer |
There was a problem hiding this comment.
| // Noop wrt. MBT. The model will follow up with the propoer | |
| // Noop wrt. MBT. The model will follow up with the proper |
| impl EmeraldDriver { | ||
| /// Locates the system under test and use the driver's runtime to wait for | ||
| /// the execution of the given future. | ||
| pub fn perform<'a, F, Fut>(&'a mut self, node: Node, action: F) -> Result<()> |
There was a problem hiding this comment.
curious why this is implemented separately.
| let peer_id = PeerId::from_multihash(Default::default()) | ||
| .map_err(|err| anyhow!("Failed to create peer id: {err:?}"))?; |
There was a problem hiding this comment.
so, it's always from the same peer_id?
| }) | ||
| .transpose()?; | ||
|
|
||
| if proposal != emerald_proposal { |
| F: FnOnce(&'a mut Sut, &'a mut History) -> Fut, | ||
| Fut: Future<Output = Result<()>>, |
There was a problem hiding this comment.
don't know if it'll fit nicely but there exists AsyncFnOnce.
| runs-on: ubuntu-latest | ||
| # XXX: Do not block on MBT initially until we gain confidence CI is not | ||
| # flaky for any reason. | ||
| continue-on-error: true |
There was a problem hiding this comment.
can you also add a timeout here ?
This patch connects the newly added Quint specs to Emerald's code via the Quint Connect library.
PS: the best files to start reviewing are probable
tests.rsanddriver.rs.